<?php

$dom = new DOMDocument('1.0', 'utf-8');

// 首先创建新的节点元素
$element = $dom->createElement('test', 'This is the root element!');

// 插入新节点元素到root节点(child of the document)
$dom->appendChild($element);

echo $dom->saveXML();
?>